<div class="wrap">
    <div id="icon-upload" class="icon32"><br></div>
    <h2>Položky zdroje {$source.name} <a href="{link target='self:addSource'}" class="add-new-h2">Přidat datový zdroj</a> </h2>
    {include file="messages.html"}
    <ul class="subsubsub">
        <li><a href="{link target='self:editItems' append="sourceId"}"{if !isset($smarty.get.status_valid)} class="current"{/if}>Celkem <span class="count">({$cnt.all})</span></a> |</li>
        <li><a href="{link target='self:editItems' append="sourceId" status_valid='now'}"{if $smarty.get.status_valid == 'now'} class="current"{/if}>Aktuální <span class="count">({$cnt.now})</span></a> |</li>
        <li><a href="{link target='self:editItems' append="sourceId" status_valid='future'}"{if $smarty.get.status_valid == 'future'} class="current"{/if}>Budoucí <span class="count">({$cnt.future})</span></a> |</li>
        <li><a href="{link target='self:editItems' append="sourceId" status_valid='past'}"{if $smarty.get.status_valid == 'past'} class="current"{/if}>Minulé <span class="count">({$cnt.past})</span></a></li>
    </ul>
    <form id="posts-filter" action="{link target='self:itemBulkAction'}" method="post">
        <input name="token" type="hidden" value="{wp_nonce target='self:itemBulkAction'}" />
        <input name="sourceId" type="hidden" value="{$source.sourceId}" />
        <div class="tablenav top">
            <div class="alignleft actions">
                <select name="action1">
                    <option value="-1" selected="selected">Hromadné úpravy</option>
                    <option value="remove">Odstranit</option>
                </select>
                <input type="submit" name="" id="doaction" class="button-secondary action" value="Použít">
            </div>
            {include file="pager.html" position='top' pager=$pager page='editItems' append='orderBy,order'}
            <br class="clear">
        </div>
        <table class="wp-list-table widefat fixed pages" cellspacing="0">
            <thead>
                <tr>
                    <th scope="col" id="cb" class="manage-column column-cb check-column" style="">
                        <input type="checkbox">
                    </th>
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='name'}">
                        <a href="{sortlink orderBy='name' append='paged,sourceId'}"><span>Název</span><span class="sorting-indicator"></span></a>
                    </th>
                    {if $source.content != 'video' || $source.type == 'tag'}
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='length'}" style="">
                        <a href="{sortstate orderBy='length' append='paged,sourceId'}"><span>Délka</span><span class="sorting-indicator"></span></a>
                    </th>
                    {/if}
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='position'}" style="">
                        <a href="{sortlink orderBy='position' append='paged,sourceId'}"><span>Pozice</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='validFrom'}" style="">
                        <a href="{sortlink orderBy='validFrom' append='paged,sourceId'}"><span>Platnost od</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='validTo'}" style="">
                        <a href="{sortlink orderBy='validTo' append='paged,sourceId'}"><span>Platnost do</span><span class="sorting-indicator"></span></a>
                    </th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th scope="col" id="cb" class="manage-column column-cb check-column" style="">
                        <input type="checkbox">
                    </th>
                    <th scope="col" id="title" class="manage-column column-title sortable desc" style="">
                        <a href="#"><span>Název</span><span class="sorting-indicator"></span></a>
                    </th>
                    {if $source.content != 'video' || $source.type == 'tag'}
                    <th scope="col" id="title" class="manage-column column-title sortable desc" style="">
                        <a href="#"><span>Délka</span><span class="sorting-indicator"></span></a>
                    </th>
                    {/if}
                    <th scope="col" id="title" class="manage-column column-title sortable desc" style="">
                        <a href="#"><span>Pozice</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column column-title sortable desc" style="">
                        <a href="#"><span>Platnost od</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column column-title sortable desc" style="">
                        <a href="#"><span>Platnost do</span><span class="sorting-indicator"></span></a>
                    </th>
                </tr> 
            </tfoot>
            <tbody id="the-list">
                {foreach $source_items as $source_item} 
                <tr class="{cycle values='alternate,'}" valign="top">
                    <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="{$source_item.itemId}"></th>
                    <td class="post-title page-title column-title">
                        <strong>
                            <a class="row-title" href="{link target='self:editFrame' frameId=$frame.frameId}" title="Upravit „{$frame.name|escape}“">{$source_item.name|escape}</a><!-- - Pokus -->
                        </strong>
                        <div class="row-actions">
                            <span class="edit"><a href="{link target='self:editItem' itemId=$source_item.itemId append='sourceId'}" title="Upravit tuto položku">Upravit</a> | </span>
                            {if $source_item.position > 1}
                            <span class="edit"><a href="{link target='self:decreaseItemPosition' itemId=$source_item.itemId append='sourceId'}" title="Upravit tuto položku">Posunout výše</a> | </span>
                            {/if}
                            {if $source_item.position < count($source_items)}
                            <span class="edit"><a href="{link target='self:increaseItemPosition' itemId=$source_item.itemId append='sourceId'}" title="Upravit tuto položku">Posunout níže</a> | </span>
                            {/if}
                            <span class="trash"><a class="submitdelete" title="Přesunout tuto položku do koše" href="{link target='self:removeItem' itemId=$source_item.itemId append='sourceId' token='true'}">Odstranit</a></span>
                    </td>
                    {if $source.content != 'video' || $source.type == 'tag'}
                    <td class="post-title page-title column-title">
                        {$source_item.duration|escape}s
                    </td>
                    {/if}
                    <td class="post-title page-title column-title">
                        {$source_item.position|escape}
                    </td>
                    <td class="post-title page-title column-title">
                        {$source_item.validFrom|escape}
                    </td>
                    <td class="post-title page-title column-title">
                        {$source_item.validTo|escape}
                    </td>
                </tr>
                {foreachelse}
                <tr>
                    <td colspan="5">Nejsou zadány žádné položky.</td>
                </tr>
                {/foreach}
            </tbody>
        </table>
        <div class="tablenav bottom">
            <div class="alignleft actions">
                <select name="action2">
                    <option value="-1" selected="selected">Hromadné úpravy</option>
                    <option value="remove">Odstranit</option>
                </select>
                <input type="submit" name="" id="doaction2" class="button-secondary action" value="Použít">
            </div>
            <div class="alignleft actions">
            </div>
            {include file="pager.html" position='top' pager=$pager page='editItems' append='orderBy,order'}
            <br class="clear">
        </div>
    </form>    
    <form name="addlink" id="addlink" method="post" action="{link target='self:editItems' append='sourceId'}" style="width: 500px">
        <input type="hidden" name="action" value="add">
        <div id="poststuff" class="metabox-holder">
            <div id="post-body">
                <div id="post-body-content">
                    <div class="stuffbox">
                        <h3><label for="link_name">Nová položka</label></h3>
                        <div class="inside"> 
                            <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
                                <tbody>
                                    <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[targetId]">Položka</label></th>
                                        <td>{html_options name="item[targetId]" options=$items selected=$item.targetId}</td>
                                    </tr>
                                    {if $source.content != 'video' || $source.type == 'tag'}
                                    <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[duration]">Délka zobrazení</label></th>
                                        <td><input type="text" name="item[duration]" size="30" tabindex="1" value="{$item.duration|escape}" /></td>
                                    </tr>
                                    {/if}
                                    <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[validFrom]">Platná od (yyyy-mm-dd hh:mm:ss)</label></th>
                                        <td><input type="text" name="item[validFrom]" size="30" tabindex="1" value="{$item.validFrom|escape}" /> </td>
                                    </tr>
                                    <tr class="form-field">
                                        <th valign="top" scope="row"><label for="item[validTo]">Platná do (yyyy-mm-dd hh:mm:ss)</label></th>
                                        <td><input type="text" name="item[validTo]" size="30" tabindex="1" value="{$item.validTo|escape}" /></td>
                                    </tr>
                                </tbody>
                            </table>                            
                        </div>
                        <div class="ads-form-footer">
                            <div id="major-publishing-actions">
                                <div id="delete-action">
                                    <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="Přidat položku">
                                </div>
                                <div id="publishing-action">

                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>                    
                </div>
            </div>
        </div>
    </form>
</div>
